import request from '@/utils/request.js'

// 文章管理
export const articleListService = (params) => {
    return request.post('/api/article/list', params)
}

export const articleAddService = (articleData) => {
    return request.post('/api/article', articleData)
}

export const articleUpdateService = (id, articleData) => {
    return request.put(`/api/article/${id}`, articleData)
}

export const articleSearchService = (params) => {
    return request.post('/api/article/search', params)
}

export const articleViewIncrementService = (id) => {
    return request.patch(`/api/article/${id}/view`)
}

export const articleBatchDeleteService = (ids) => {
    return request.delete('/api/article/batch', { data: { ids } })
}

export const articleDetailService = (id) => {
    return request.get(`/api/article/${id}`)
}

export const articleStatusUpdateService = (id, status) => {
    return request.patch(`/api/article/${id}/status`, { status })
}